﻿Imports System.Web.Mail
Imports System.Web
Imports System.Data.SqlClient
Imports System.Data

Partial Class _111_UC02_020
    Inherits System.Web.UI.Page
    Private strName As String = ""
    Private strPass As String = ""
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub LoginButton_Click1(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim strErrors As String = ""
        Dim strSuccess As String = ""
        Dim flag As Boolean = 0
        Dim frmViewProfile As New _111_UC02_020
        'Dim filename As String = "D:/Program/EC/eCSS - Version 01-080420/eCSS - Version 01/App_Data/practise01.mdb"
        'Using Sql server 2000 or 2005
        Dim strConnect As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Ngoc Thanh\University Project\ASP - EC new\EC - 20080520\App_Data\HAIDANG_DATABASE.mdf;Integrated Security=True;User Instance=True"
        'Using access
        'Dim strCon As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
        Dim cn As New SqlConnection(strConnect)
        cn.Open()
        strName = Login1.UserName
        strPass = Login1.Password
        Dim cmd As New SqlCommand("select PassWord from M_TAIKHOAN where TenDangNhap= '" + Login1.UserName.ToString + "'", cn)
        Dim adapter As New SqlDataAdapter(cmd)
        Dim table As DataTable = New DataTable("TenDangNhap")
        adapter.Fill(table)
        cn.Close()
        If table.Rows.Count > 0 Then
            strSuccess += "Thank you for login." + vbNewLine
            MsgBox(strSuccess, MsgBoxStyle.Information, "Information")
            If Login1.Password = Login1.Password And Login1.UserName = "Ngo Hai Dang" Then
                Response.Redirect("http://localhost:2149/EC%20-%2020080520/UC04-020.aspx")
            Else
                Response.Redirect("http://localhost:2149/EC%20-%2020080520/UC02-010.aspx")
            End If
        End If
    End Sub
End Class
